#include "MCU_include.h"

u8	BuzDelay = 0, FanDelay = 0;
bit bit_BUZZER = 0, bit_FAN = 0;

void BuzzerFan(unsigned int FanDelayTime_S)
{
	static u16 FanDelayCnt = 0;
	if (bit_BUZZER)
	{
		BUZZER_ON();
		if (--BuzDelay == 0)
		{
			BUZZER_OFF();
			bit_BUZZER = OFF;
		}
	}
	else
	{
		BUZZER_OFF();	
	}
	if (ControlSet_App.flagBit.on_off == 0)
	{
		if (bit_FAN)
		{
			if (--FanDelay == 0)
			{
				FanDelay = 100;
				if (++FanDelayCnt >= FanDelayTime_S)
				{
					FanDelayCnt = 0;
					FAN = OFF;
				}
			}		
		}
	}
	else
	{		
		if( ControlSet_App.flagBit.fan)
		{ 
			bit_FAN=ON;
			FAN=ON;
		}	
	}
	
	
}


void BuzzerProcess()
{
	if (ControlSet_App.flagBit.beep == 0)
	{
		bit_BUZZER = OFF;
		
	}            
	if (ControlSet_App.flagBit.beep == 1)
	{
		bit_BUZZER = ON;
		BUZZER_ON_20MS();
	}
//	else if (ControlSet_App.flagBit.beep == 2)
//	{
//		BUZZER_ON_200MS();
//	}
//	else if (ControlSet_App.flagBit.beep == 3)
//	{
//		BUZZER_ON_400MS();
//	} 	
}

/******************* End of  file ***************/